/*
 * MODBUS Slave Library: A portable MODBUS slave for MODBUS ASCII/RTU/TCP.
 * Copyright (c) 2008 Christian Walter <cwalter@embedded-solutions.at>
 * Copyright (c) 2020 Embedded Experts GmbH <modbus@embedded-experts.at>
 *
 * All rights reserved. Use of this file is subject to license terms.
 */

#ifndef _MBSI_FRAME_H
#define _MBSI_FRAME_H

#include "mbtypes.h"
#include "mbs.h"
#include "mbport.h"

/* ----------------------- Defines ------------------------------------------*/

/*! \brief An invalid frame handle.
 * \internal
 */
#define MBS_FRAME_HANDLE_INVALID ( NULL )

/*! \brief Dummy address used by the stack to answer all MODBUS requests.
 * \internal
 */
#define MBS_ANY_ADDR ( 255 )

/* ----------------------- Type definitions ---------------------------------*/

/*! \brief A handle for a frame handler instance.
 * \internal
 */
typedef void *xMBSFrameHandle;

typedef eMBErrorCode ( *peMBSFrameSend )( xMBSHandle xHdl, USHORT usMBPDULength );

typedef eMBErrorCode ( *peMBSFrameReceive )( xMBSHandle xHdl, UBYTE *pubSlaveAddress, USHORT *pusMBPDULength );

typedef eMBErrorCode ( *peMBSFrameManagement )( xMBSHandle xHdl );

typedef eMBErrorCode ( *peMBSFrameClose )( xMBSHandle xHdl );

#endif
